/*
* @Author: xfy
* @Date:   2017-09-07 12:39:27
* @Last Modified by:   xfy
* @Last Modified time: 2017-09-15 14:45:13
*/
'use strict';
var _supper = require('util/supper.js');
var _adminProduct = {
    //获取商品列表
    getProductList : function(listParam, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/productManage!getList'),
            data    : listParam,
            success : resolve,
            error   : reject
        });
    },
    //根据ID或者名字查找商品
    productSearch : function(productData, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/productManage!productSearch'),
            data    : productData,
            success : resolve,
            error   : reject
        });
    },
    //获取某个商品的详细信息
    getProductDetail : function(productId, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/productManage!getProductDetail'),
            data    : {
                id : productId
            },
            success : resolve,
            error   : reject
        });
    },
    productSave : function(productInfo, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/productManage!productSave'),
            data    : productInfo,
            async   : 'false',
            success : resolve,
            error   : reject
        });
    },
    setSaleStatus : function(productInfo, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/productManage!setSaleStatus'),
            data    : productInfo,
            success : resolve,
            error   : reject
        });
    }
}
module.exports = _adminProduct;